
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Square.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Square_checkArea)
{
        TEST(check input of width, bigger than max limit, get area 0)
        {
                Square squ(84.123);
                ASSERT_EQ(0, squ.getArea());
        }

        TEST(check input of width equal to max limit, get area 0)
        {
                Square squ(75);
                ASSERT_EQ(0, squ.getArea());
        }

        TEST(check input of width, smaller than min limit, get area 0)
        {
                Square squ(-2.557);
                ASSERT_EQ(0, squ.getArea());
        }


        TEST(check input of width, valid input, get area value.)
        {
                Square squ(57.265);
                ASSERT_EQ(3278.71, squ.getArea());
        }       
};

FIXTURE(Square_checkPerimeter)
{
        TEST(check input of width, bigger than max limit, get perimeter 0)
        {
                Square squ(78.557);
                ASSERT_EQ(0, squ.getPerimeter());
        }

        TEST(check input of width equal to max limit, get perimeter 0)
        {
                Square squ(75);
                ASSERT_EQ(0, squ.getPerimeter());
        }
        
        TEST(check input of width, smaller than min limit, get perimeter 0)
        {
                Square squ(-2.557);
                ASSERT_EQ(0, squ.getPerimeter());
        }

        TEST(check input of width, valid input, get perimeter value)
        {
                Square squ(50.998);
                ASSERT_EQ(203.96, squ.getPerimeter());
        }
};

FIXTURE(Square_changeShape_checkArea)
{
        TEST(check change Square, and new width bigger than max limit, get area unchanged)
        {
                Square squ(41.123);
                squ.changeShape(76.101); 
                ASSERT_EQ(1690.85, squ.getArea());
        }

        TEST(check change Square, and new width equal to max limit, get area unchanged)
        {
                Square squ(41.123);
                squ.changeShape(75);        
                ASSERT_EQ(1690.85, squ.getArea());
        }

        TEST(check change Square, and new width smaller than min limit, get area unchanged)
        {
                Square squ(41.123);
                squ.changeShape(-2.3);
                ASSERT_EQ(1690.85, squ.getArea());
        }

        TEST(check change Rectangle, valid input, get new area value)
        {
                Square squ(51.123);
                squ.changeShape(41.123);
                ASSERT_EQ(1690.85, squ.getArea());
        }
};
